package merlin.managers;

import java.sql.*;

import merlin.beans.*;
import merlin.dao.*;

public class FinancialDetailsManager{

	public static DbResultSet selectFinancialDetailsRecordsByCompanyNumber(String companyNumber){
		DbResultSet result = null;
		Connection con=null;
		ConnectionPool pool = null;
		try{
			pool = ConnectionPool.getConnectionPool("researcher");
			con = pool.getConnection();

			FinancialDetailsDAO dao = new FinancialDetailsDAO(con);
			result = dao.selectFinancialDetailsRecordsByCompanyNumber(companyNumber);
		}catch(Exception e){
			System.err.println(e);
			throw new RuntimeException(e);
		}finally{
			pool.returnConnection(con);
			con=null;
		}
		return result;
	}

	public static FinancialDetailsBean selectFinancialDetailsByPK(String pk){
		FinancialDetailsBean bean = null;
		Connection con=null;
		ConnectionPool pool = null;
		try{
			pool = ConnectionPool.getConnectionPool("researcher");
			con = pool.getConnection();

			FinancialDetailsDAO dao = new FinancialDetailsDAO(con);
			bean = dao.selectFinancialDetailsByPK(pk);
		}catch(Exception e){
			System.err.println(e);
			throw new RuntimeException(e);
		}finally{
			pool.returnConnection(con);
			con=null;
		}
		return bean;
	}
}